<%@page import="java.util.*"%>
<%@page import="java.text.*"%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<%
    String path = request.getContextPath(); 
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+path+ "/"; 
%>
<!DOCTYPE HTML>
<html>
<head>
	<base href="<%=basePath%>">
	<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
	<title>司机端行程反馈列表</title>
	<link rel="stylesheet" href="plugin/bootstrap-3.3.7-dist/css/bootstrap.min.css" />
	<link rel="stylesheet" href="css/bootstrap-datetimepicker.css" />
    <link rel="stylesheet" href="plugin/bootstrap-table/dist/bootstrap-table.css">
<style type="text/css">

ul{
    list-style-type: none;
}
 .breadcrumb{
          padding: 21px 25px;
       }    
  a {
    color: #2a3f54;
}      
</style>

</head>
<body>
    <div class="row base-margin" id="query">
        <ul class="breadcrumb">
				<li style="padding-left: 15px"><i class="icon-home home-icon"></i> <a href="javascript:void(0)">System Settings(系统设置)</a>
				</li>
				<li class="active">
				<a href="view/sys/driver_feedback_list.jsp">Rider’s Review(行车反馈列表)</a></li>
        </ul>
         <div class="form-group">
              &nbsp;&nbsp;&nbsp;&nbsp;<button type="button" id="queryBtn" onclick="jump('view/sys/driver_feedback_list.jsp')" class="btn btn-primary" >Cleaning fee feedback(清洁费反馈)</button>
                  <button type="button" id="queryBtn" onclick="jump('view/sys/starRemark_list.jsp')"class="btn" style='background-color: white;border: 1px solid;' >Review(评论反馈)</button>
           </div> 
        
        <form class="form-inline" role="form" style="float: left; width: 100%" method="post" id="queryForm">
           
           <div class="form-group">  
                <label for="bName">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Registration time(注册时间):</label> 
                <input type="text" class="form-control input-append form_date"  id="startTime" />-
                <input type="text" class="form-control input-append form_date"   id="endTime" />
            </div>   
             <div class="form-group">  
                <label for="bName">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Feedback account(反馈账号):</label> 
                <input type="text" class="form-control"  id="account"  />
            </div>  
            
              <div class="form-group">  
                <label for="bName">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Status:</label> 
               <select class="form-control" id="remarks">
                  <option value=''>Total</option>
                   <option value='1'>Not Complete</option>
                    <option value='2'>Complete</option>
               </select>
            </div>  
            <div class="form-group">
                <button type="button" id="queryBtn" onclick="doQuery1('demo-table',queryParams1());" class="btn btn-primary">Search(搜索)</button>
            </div> 
        </form>
    </div>
    <div class="container" style="width: 100%;margin-top:15px">
        <table id="demo-table">
        </table>
    </div>
</body>
	<!-- 加载需要的js -->
	<script src="js/jquery-3.2.1.min.js"></script>
	<script src="plugin/bootstrap-3.3.7-dist/js/bootstrap.min.js"></script>
	<script src="js/jquery-bootstrap-pagination.js"></script>
	<script src="plugin/bootstrap-table/dist/bootstrap-table.min.js"></script>
	<script src="plugin/bootstrap-table/dist/locale/bootstrap-table-zh-CN.min.js"></script>
	<!--时间  -->
	<script src="js/bootstrap-datetimepicker.js"></script>
	<script src="js/bootstrap-datetimepicker.zh-CN.js"></script>
	<script src="js/common.js"></script>
	<script src="plugin/layer/layer.js"></script>
	<!-- 查询客户端ip使用 -->
	<script src="http://pv.sohu.com/cityjson?ie=utf-8"></script>  
	
	
	<script type="text/javascript" charset="utf-8">
	function jump(url){
		window.location.href=url;
	}
	$(function () {
		initPath("<%=basePath%>");
	    initTable('demo-table',queryParams,columns,"sugFeedback/getComments");
	});
	
	   $('.form_date').datetimepicker({
	        minView: "month", //选择日期后，不会再跳转去选择时分秒 
	        language: 'zh-CN',
	        format: 'dd/mm/yyyy',
	        todayBtn:  1,
	        autoclose: 1,
	    });
var  columns= [ 
	  {  field : 'id',  title : 'Operation(操作)', align : 'center', valign : 'middle',formatter:function(value, row, index){
	    		 return "<a href='javascript:void(0);' style='color:blue' onclick='sure(\""+row.id+"\")'>Delete the comment</a>"
	     } },
	 { field : 'orderNo',  title : 'Order Number(订单号)',  align : 'center', valign : 'middle'},
	 { field : 'createTime',  title : 'Review time(反馈时间)',  align : 'center', valign : 'middle',formatter:timeStamp2String },
	 { field : 'telephone',  title : 'Feedback Content(反馈内容)',  align : 'center', valign : 'middle' },
	 { field : 'content', title : 'detailed description(详细描述)', align : 'center', valign : 'middle' },
	 { field : 'oa_status', title : 'Status(处理状态)', align : 'center', valign : 'middle',formatter:function(value, row, index){
		 var str1="<a style='color:blue' href='javascript:void(0);' onclick='update(\""+row.id+"\",2)'>Not Complete</a>";
		 if(value==2){
			 str1="Complete";
		 }
		 return str1;
	 } },
	 { field : 'remark', title : 'Notes(备注)', align : 'center', valign : 'middle' }
	 ];
	 
	  //删除评论
	 function sure(id){
		 $.ajax({
				type:'get',
				url:"sugFeedback/delComments?id="+id,
		         success: function(data){   
		        	 if(data.code==200){
		        		 layer.closeAll();
		        		 doQuery1('demo-table',queryParams());
		        	       }else{
		        	    	    layer.msg(data.msg);
		        	       }
		         }
			});
	 }
	  function update(id){
		  layer.open({
			  type: 1,
			  title: "Status",
			  skin: 'layui-layer-rim', //加上边框
			  area: ['320px', '180px'], //宽高
			  content: ' <form id="add" ><table style="margin-left:10px">'+
	          '  <tr class="padtr"><td class="pad" >Notes(描述):</td> '+
	          '<td><input type="text" id="remark" name="remark" value=""/></td>'+
	          '</tr>'+
	          ' <tr align="center" class="padtr"><td colspan="5">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'+
	          ' &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'+
	          ' <button type="button"  onclick="cacel()"class="btn  btn1" style="border: 1px solid;margin-top:10px">&nbsp;取&nbsp;消&nbsp;&nbsp;</button>'+
	          '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'+
	          '<button type="button" onclick="updateStatus('+id+',2)" class="btn btn-info btn1" style="margin-top:10px">&nbsp;&nbsp;保&nbsp;存&nbsp;&nbsp;</button></td></tr></table></form>'
			});
	  }
	  //更新状态
function updateStatus(id,status){
		  var remark=$('#remark').val();
	var data=JSON.stringify({"id":id,"oa_status":status,"remark":remark});
	 $.ajax({
			type:'post',
			url:"sugFeedback/addOrUpdateComments",
			 data: data,
	         contentType:"application/json;charset=UTF-8", 
	         dataType:"json",
	         success: function(data){   
	        	 if(data.code==200){
	        		 layer.closeAll();
	        		 doQuery1('demo-table',queryParams());
	        	       }else{
	        	    	    layer.msg(data.msg);
	        	       }
	         }
		});
	
}
function cacel(){
	layer.closeAll();
}

	function queryParams(params) {
		 console.log(params);  
	    var param = {
	    		startTime:$('#startTime').val(), 
	    		endTime:$('#endTime').val(),
	    		telephone:$('#telephone').val(),
	    		remark:$('#remarks').val(),
	    		pageNo : this.pageNumber,
	        pageSize : this.pageSize
	    }	
	    return param;
	} 
	function queryParams1(){
		 var param = {
				 startTime:$('#startTime').val(), 
		    		endTime:$('#endTime').val(),
		    		telephone:$('#telephone').val(),
		    		remark:$('#remarks').val(),
		        pageNo : 1,
		        pageSize : this.pageSize
		    }	
		    return param;
	}
	</script>
</html>


